class Solution(object):
    def lengthOfLIS(self, nums):
        """
        :type nums: List[int]
        :rtype: int
        """
        LIS = [1] * len(nums)
        for i, num in enumerate(nums):
            for j, lis in enumerate(LIS[0:i]):
                if nums[j]<num:
                    LIS[i] = max(LIS[i], lis+1)
        return 0 if len(LIS)==0 else max(LIS)

s = Solution()
print(s.lengthOfLIS([10,9,2,5,3,7,101,18]))